package main

import "fmt"

type Singleton struct{}

var instance = &Singleton{} // 提前初始化

func GetInstance() *Singleton {
	return instance
}

func main() {
	s1 := GetInstance()
	s2 := GetInstance()

	fmt.Println(s1 == s2) // 输出: true，表示是同一实例
}
